// import useAxiosApi from '/@/utils/useAxiosApi';

// /**
//  * 账号密码登录
//  * @returns UseAxiosReturn
//  */
// export function loginPassword() {
//   return useAxiosApi(`/api/login`, {
//     method: 'POST',
//     data: { name: '123' },
//   });
// }

import { ReqAuth, ReqParams, ReqData1, ReqData2, ReqData3, ReqData4, ReqData5, ResResult, myfriendsResResult } from './model';
import { get, post } from '/@/utils/useAxiosApi';

enum URL {
  login = '/api/login',
  getUserInfo = '/api/getInfo',
  register = '/api/register',
  getMyfriends = '/api/myfriends',
  queryUser = '/api/queryUser',
  addFriends = '/api/addFriends',
  getFriendsInfo = '/api/getFriendsInfo',
  queryChatInfo = '/api/query/msg',
  sendMsg = '/api/send/msg',
}

const loginPassword = async (data: ReqParams) => post<ResResult>({ url: URL.login, data });

const getUserInfo = async () => post<ReqAuth>({ url: URL.getUserInfo, hideloading: true });

const register = async (data: ReqParams) => post<ResResult>({ url: URL.register, data });

const getMyfriends = async () => post<myfriendsResResult>({ url: URL.getMyfriends });

const queryUser = async (data: ReqData1) => post<ResResult>({ url: URL.queryUser, data });

const addFriends = async (data: ReqData2) => post<ResResult>({ url: URL.addFriends, data });

const getFriendsInfo = async (data: ReqData3) => post<ResResult>({ url: URL.getFriendsInfo, data, hideloading: true });

const queryChatInfo = async (params: ReqData4) => get<ResResult>({ url: URL.queryChatInfo, params, hideloading: true });

const sendMsg = async (data: ReqData5) => post<ResResult>({ url: URL.sendMsg, data, hideloading: true });

export default { loginPassword, getUserInfo, register, getMyfriends, queryUser, addFriends, getFriendsInfo, queryChatInfo, sendMsg };
